package 笔试.去哪儿;

import java.util.*;

public class 会员挑战 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long m = sc.nextLong();
        int[] nums = new int[n];
        int[] cards = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        LinkedList<Integer> sortedCards = new LinkedList<>();
        TreeSet<Integer> sortedNums = new TreeSet<>(Comparator.comparingInt(Integer::intValue));
        for (int i = 1; i <= n; i++) {
            long sum = 0;
            sortedNums.add(nums[i - 1]);
            sortedCards.add(cards[i - 1]);
            ArrayList<Integer> sortedCard = new ArrayList<>(sortedCards);
            ArrayList<Integer> sortedNum = new ArrayList<>(sortedNums);
            for (int j = 0; j < i; j++) {
                sum += (long) sortedCard.get(j) * sortedNum.get(j);
                if (sum >= m) {
                    System.out.println(i);
                    return;
                }
            }
        }
        System.out.println(-1);
    }

}